//
//  GameBlock.m
//  DualSnake
//
//  Created by HacJune Lee on 13. 12. 6..
//  Copyright (c) 2013년 HakJune Lee. All rights reserved.
//

#import "GameBlock.h"

@implementation GameBlock

-(id)initWithBlockType:(int)gameBlock
{
    self = [super init];
    if(self)
    {
        _gameBlockType = gameBlock;
        _drawWidth = [[GameMaster shared]getGridWidth];
    }
    return self;
}

//initSetting
-(void)settingWithImage:(UIImage*)drawImage drawPoint:(CGPoint)drawPoint
{
    _drawImage = drawImage;
    _drawPoint = drawPoint;
    _gridNum = [[GameMaster shared]convertCGpointToGridNum:_drawPoint];
}

-(void)settingWithImage:(UIImage*)drawImage gridNum:(int)gridNum
{
    _drawImage = drawImage;
    _gridNum = gridNum;
    _drawPoint = [[GameMaster shared]convertGridNumToCGPoing:_gridNum];
}


-(void)resetDrawPoint
{
    _drawPoint = [[GameMaster shared]convertGridNumToCGPoing:_gridNum];
}

//block draw;
-(void)drawGameblock
{
    if(_drawImage == nil)
    {
        NSLog(@"game block No image");
    }
    else
    {
        [_drawImage drawInRect:CGRectMake(_drawPoint.x, _drawPoint.y, _drawWidth, _drawWidth)];
    }
}

@end
